<template>
  <div v-if="state" id="app">
    <!-- <div id="nav">
      <router-link to="/baojie">baojie</router-link> |
      <router-link to="/repair">Repair</router-link> |
      <router-link to="/repairSuccess">RepairSuccess</router-link> |
      <router-link to="/orderDetail">OrderDetail</router-link> |
      <router-link to="/orderList">OrderList</router-link> | 
      <router-link to="/person">person</router-link> |
      <router-link to="/register">register</router-link> |
      <router-link to="/tuijian">推荐有礼</router-link>
    </div> -->
    <router-view/>
  </div>
</template>

<style lang="scss" scoped>
#app {
  min-height: 100%;
  // background-color: #eeeeee;
}

</style>
<script>
import {MessageBox} from 'mint-ui'
// import {mapState,mapMutations} from 'vuex'
export default {
  data(){
    return {
      state:true,
    }
  },
  created(){

    //判断访问
    function isWeiXin() {
      var ua = window.navigator.userAgent.toLowerCase();
      // console.log(ua);//mozilla/5.0 (iphone; cpu iphone os 9_1 like mac os x) applewebkit/601.1.46 (khtml, like gecko)version/9.0 mobile/13b143 safari/601.1
      if (ua.match(/MicroMessenger/i) == 'micromessenger') {
        return true;
      } else {
        return false;
      }
    }
      if(!isWeiXin()){
        this.state = false;
        MessageBox.alert('请用微信打开。');
      }
    //设置token
    let accessToken = sessionStorage.getItem('accessToken');
    if(!accessToken || accessToken==='undefined'){
        sessionStorage.setItem('accessToken',this.$route.query.accessToken);
    }
  }
}

</script>





